import numpy as np
from skimage.transform import resize

mean = np.array([0.485, 0.456, 0.406], dtype=np.float32)
std = np.array([0.229, 0.224, 0.225], dtype=np.float32)

def simple_preprocess(image: np.ndarray) -> np.ndarray:
    resized = resize(image, (224, 224)).astype(np.float32)
    print('input_max:', np.max(resized))
    print('input_min:', np.min(resized))
    return np.ascontiguousarray(resized.transpose(2, 0, 1))

def preprocess(image: np.ndarray) -> np.ndarray:
    resized = resize(image, (224, 224)).astype(np.float32)
    print('resized.dtype:', resized.dtype, 'np.max(resized):', np.max(resized), 'np.min(resized)', np.min(resized))
    ret = (resized - mean) / std
    print('np.max(ret):', np.max(ret), 'np.min(ret):', np.min(ret))
    return np.ascontiguousarray(ret.transpose(2, 0, 1))
